package org.inspursc.s0517.health.common.dao;

import org.inspursc.s0517.health.common.entity.SysGroup;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;


public interface SysGroupDao extends JpaRepository<SysGroup, Integer> {

    @Query(value = "select sg.* from sys_group sg " +
            "left join sys_group_role sgr ON sg.id=sgr.sys_group_id " +
            "where sgr.sys_role_id=?1", nativeQuery = true)
    List<SysGroup> findByRoleId(Integer roleId);
}
